<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>手动扣款</title>
    <link rel="stylesheet" href="../../css/weui.min.css">
    <link rel="stylesheet" href="../../css/weuix.css">
    <link rel="stylesheet" href="../../css/font-awesome.min.css">

    <script src="../../js/jquery.min.js"></script>
    <script src="../../js/jquery-weui.min.js"></script>
    <script type="text/javascript" src="../../js/jquery.cookie.js"></script>
    <script src="../../js/vue.js"></script>
    <script src="../../js/axios.min.js"></script>

    <script type="text/javascript" src="../../js/qiniu.js?t=1"></script>
    <script type="text/javascript" src="../../js/moxie.min.js"></script>
    <script type="text/javascript" src="../../js/plupload.full.min.js"></script>

    <script src="../../js/app.js?t=2"></script>
    <script>
        var id = getUrlParam('id');
    </script>
    <style>
        #app {
            width: 90%;
            margin: 10px auto;
        }
        .weui-btn_primary {
            background-color: #f86e25;
            color: #ffffff;
            width: 100%;
        }

        .weui-cell__hd{
            width: 25%;
        }

        .weui-flex__item img{
            width: 100%;
        }
        .spanred{
            color: #ff0000;
        }
    </style>
</head>

<body>

<div ontouchstart id="app">



    <div class="weui-cells" >
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <p><span class="spanred">*</span> 扣款金额</p>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="number"   placeholder="请输入扣款金额" v-model="order.repayment_fee">
            </div>
        </div>


    </div>


    <div class="weui-btn-area">
        <a class="weui-btn weui-btn_primary" href="javascript:"  v-on:click="repayment">确定扣款</a>
    </div>

</div>

<script>
    var app = new Vue({
        el: '#app',
        data: {
            order : {
                repayment_fee:''
            }
        },
        mounted: function () {

        },
        methods: {
            repayment: function () {
                var vm = this;

                $.confirm({
                    title: '提醒',
                    text: '确定要扣款吗？',
                    onOK: function () {
                        $.showLoading("扣款中,请稍后...");
                        axios.post('/api/transfer/protocol/payin/one', {
                            'id':id,
                            'repayment_fee':vm.order.repayment_fee,
                        }).then(function (response) {
                            var obj = response.data;
                            if(obj.code == 0) {
                                setTimeout(function(){
                                    $.hideLoading();
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index); //再执行关闭
                                    parent.$(".container-refresh").click();
                                }, 2000)
                            }else{
                                $.showLoading(obj.text);
                                setTimeout(function(){
                                    $.hideLoading();
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index); //再执行关闭
                                    parent.$(".container-refresh").click();
                                }, 2000)
                            }
                        }).catch(function (response) {
                            $.alert('网络异常');
                        });
                    },
                    onCancel: function () {
                    }
                });


            },

        }
    });

</script>

</body>
</html>
